
DEFINE VARIABLE part AS CHARACTER FORMAT 'X(18)'.
DEFINE VARIABLE net AS decimal FORMAT '->>>>9.99<<<<'. 

DEFINE STREAM aa.

define temp-table ptmstr no-undo
   field ptpart  AS CHARACTER FORMAT 'X(18)'
   field ptnet  AS decimal FORMAT '->>>>9.99<<<<'
    index ptmstr is PRIMARY  unique
    ptpart. 
for each ptmstr exclusive-lock:
      delete ptmstr.
end. 




 mainloop:
 REPEAT:
  INPUT FROM VALUE(SEARCH("d:\book1.csv")).
       DO  WHILE TRUE on error UNDO mainloop,LEAVE mainloop:
             IMPORT DELIMITER "," part net NO-ERROR.
       FIND FIRST ptmstr WHERE ptpart=part NO-ERROR .
       IF NOT AVAILA(ptmstr) THEN DO:
      
          create ptmstr.
          assign
            ptpart      = part
              ptnet  =  net.
        END.

       END.
  INPUT CLOSE.
 END.
 OUTPUT TO d:\errlist.txt.
 for each ptmstr NO-LOCK:
   FIND FIRST pt_ WHERE pt_part=ptpart NO-ERROR.
   IF AVAIL(pt_) THEN DO:
       ASSIGN pt_net_wt = ptnet
              pt_net_wt_um ='G'.
   END.
   ELSE  DISP ptpart.
 
 end. 


for each ptmstr exclusive-lock:
       
      delete ptmstr.
end. 

